#include "Boss3Fire.h"
#include "Box.h"
#include "Sprite.h"
#include "RSManager.h"
#include "ShareComponents.h"
#include "Camera.h"
Boss3Fire::~Boss3Fire(void)
{
}

Boss3Fire::Boss3Fire(Box* _box,float angle): Object(_box,ObjEnemy_DYNAMID)
{
	_angle = angle;
	delay = 0;
	init();
}

void Boss3Fire::init()
{
	_sprite = RSManager::getInstance()->getSprite(BOSS3_FIRE);
	_box->_size = _sprite->getRenderSize();
	this->_hits = 1;
	_colBox->_size = _box->_size;
	_box->_v.x = _box->_v.y = 3.0f;
}

void Boss3Fire::update()
{
	delay += GAME_TIME;
	if(_hits < 0)
	{
		_isAlive = false;
	}
	if(delay > 100)
	{
		delay = 0;
		_sprite->Next();
	}
	_box->_position.x += cos(_angle)  * _box->_v.x;
	_box->_position.y += sin(_angle ) * _box->_v.y;
	if(_box->getTop() < gl_camera->getTop())
	{
		_isAlive = false;
	}
}

void Boss3Fire::render()
{
	_sprite->Render(_box->_position);
}

Box* Boss3Fire::getCollisionBox()
{
	_colBox->_position = _box->_position;
	return _colBox;
}
